package com.icode.mvc.controller.key;

import com.icode.mvc.RequestMethod;

/**
 * User: Alex Zhong
 * Date: 2016/2/4
 */
public class SimpleMethodKey extends SimpleKey {
    private RequestMethod method;

    public SimpleMethodKey(String value, RequestMethod method) {
        super(value);
        this.method = method;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SimpleMethodKey)) return false;
        if (!super.equals(o)) return false;

        SimpleMethodKey that = (SimpleMethodKey) o;

        if (method != that.method) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + method.hashCode();
        return result;
    }

    @Override
    public String toString() {
        return "SimpleMethodKey{" +
                "method=" + method +
                "} " + super.toString();
    }
}
